<template>
  <div>
    <div class="xitongshehzi">
      <div class="bd2 flex-col">
        <div class="section7 flex-col">
          <div class="main2 flex-row">
            <span class="info4">首页欢迎语:</span>
            <input
              type="text"
              placeholder="您好，欢迎访问洛阳市公安局刑事侦查支队网"
              onfocus="this.placeholder=''"
              onblur="this.placeholder='您好，欢迎访问洛阳市公安局刑事侦查支队网'"
              class="box3 flex-col"
              v-model="Firstpage"
            />
          </div>
          <div class="main3 flex-row">
            <span class="txt6">默认文章来源:</span>
            <input
              type="text"
              placeholder="洛阳刑侦信息网"
              onfocus="this.placeholder=''"
              onblur="this.placeholder='洛阳刑侦信息网'"
              class="box4 flex-col"
              v-model="Defaultarticle"
            />
          </div>
          <div class="main4 flex-row">
            <span class="txt7">默认作者:</span>
            <input
              type="text"
              placeholder="洛阳刑侦"
              onfocus="this.placeholder=''"
              onblur="this.placeholder='洛阳刑侦'"
              class="box5 flex-col"
              v-model="Defaultauthor"
            />
          </div>
          <div class="main7 flex-row">
            <button  @click="onClick_1" class="wordd">
              <el-button :plain="true" @click="open1" class="word8">保存</el-button>
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      user: {
        welcome: '33',
        laiyuan: '11',
        author: '22'
      },
      constants: {},
      addsystemsettingsEmpty: [],//系统设置空数组接收数据
      Firstpage: '',
      Defaultarticle: '',
      Defaultauthor: ''
    };
  },
  methods: {
    async addsystemsettings () {
      let formData = new FormData()
      formData.append('Firstpage', this.Firstpage)
      formData.append('Defaultarticle', this.Defaultarticle)
      formData.append('Defaultauthor', this.Defaultauthor)
      const config = {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded"
        }
      }
      const { data: res } = await this.$http.post('/api/systemsetting/Post_addsystemsetting', formData, config)
      this.addsystemsettingsEmpty = res
      console.log(this.addsystemsettingsEmpty);
      // let allres = { Firstpage: this.welcome, Defaultarticle: this.laiyuan, Defaultauthor: this.author }
      // this.addsystemsettingsEmpty.push(allres)
      // this.addsystemsettingsEmpty
    },
    onClick_1 () {
      this.addsystemsettings()
    },
    open1 () {
      this.$message({
        message: '恭喜你，保存成功',
        type: 'success'
      });
    },
  }
};
</script>
<style scoped lang="css" src="./assets/index.css" />
